home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 1372.ZIP / PRINTPAS.ARC / NONSENSE.PAS next >
Pascal/Delphi Source File  |  1988-10-30  |  3KB  |  90 lines

  1. PROGRAM Nonsense_For_T_P_M_F;
  2.                      {if program name is too long for double width printing}
  3.                      {it is printed as emphasized and underlined}
  4. Const
  5. One=1;
  6.  
  7. Type
  8. shortword=string[5];
  9.  
  10. FUNCTION Square(number: integer): integer;  {use caps for "FUNCTION"}
  11.                                    {begin/end counter starts now,}
  12.                                 {continues whenever there is a change}
  13. Begin
  14.   Square:=number*number;
  15. End;
  16.                                        {use caps for "procedure"}
  17. PROCEDURE First(a: byte; b: integer; var c:word);
  18. var                     {"var" must be on a separate line, comments excepted}
  19. x,y: integer;         {this should be italics if your printer supports this}
  20. z  : byte;
  21.  
  22. Begin
  23.   x:=One;
  24.   y:=b;
  25.   z:=a;
  26.   z:=Square(z+1);
  27.   c:=z;
  28. End;
  29.  
  30. PROCEDURE Second(d: integer; e: shortword; var f: integer);
  31.  
  32. PROCEDURE Nested_Procedure(g: byte; var a: shortword);
  33. Var                    {"Var" must be on a separate line, comments excepted}
  34. s  : byte;
  35. u  : shortword;
  36.  
  37. Begin
  38.   u:=Chr(g);
  39.   s:=length(a);
  40.  
  41.   If Pos(u,a)=s then
  42.     begin
  43.       a:=Copy(a,1,s-1);
  44.     end
  45. End;
  46. var
  47. a:               shortword;
  48. g, wordlength:   byte;
  49. j:               integer;
  50.  
  51. Begin
  52.   Writeln('Enter a word up to four letters long.');
  53.   Readln(a);
  54.   wordlength:=length(a);
  55.   Case wordlength of          {the key words "case, of" must be on same line}
  56.   1,2,3,4:     Writeln('You entered a ',wordlength,' letter word.');
  57.   Else         Writeln('You entered too long a word.');
  58.   End;
  59.   f:=0;
  60.   For g:=1 to length(a) do
  61.     begin
  62.       f:=Chr(a[g])+f;
  63.       Writeln('Enter ascii code for ',g,' letter of word.');
  64.       Readln(j);
  65.       If h=j then
  66.         begin
  67.           Write(#7);
  68.           Writeln('Good!');
  69.         end;
  70.     end;
  71.   Nested_Procedure(f div length(a),a);    {index number on right side}
  72.                                                {for procedure}
  73. End;
  74.  
  75. VAR            {use caps for global var declaration,also on a separate line}
  76. GlobalA, GlobalB:  integer;
  77. GlobalWord      :  word;
  78. GlobalString    :  shortword;
  79. GlobalC         :  byte;
  80.                           {comment below is required, may be all caps}
  81. BEGIN                                  {main program}
  82.   First(GlobalC, GlobalA, GlobalWord);
  83.   Second(GlobalB, GlobalString, GlobalA);
  84.   GlobalC:=0;
  85.                   {Procedures/functions emphasized and underlined,}
  86.                      {indexing is done on right side of paper.}
  87.                   {Global variables are double strike in main program.}
  88.  
  89. END.           {Table of procedures/functions will be printed after code.}
  90.